<?php
	require_once ( '../nvslbase.php');
	require_once(NVSL_BASE.DS.'config'.DS.'config.php');
	require_once(NVSL_LIB.DS.'Doctrine'.DS.'Doctrine.php');
	spl_autoload_register(array('Doctrine', 'autoload'));
	spl_autoload_register(array('Doctrine_Core', 'modelsAutoload'));
	
	$nvsl->db_Manager = Doctrine_Manager::getInstance();
	$nvsl->db_Conexion = $nvsl->db_Manager->connection($nvsl->getDSN());
	
	$nvsl->db_Manager->setAttribute(Doctrine_Core::ATTR_VALIDATE,Doctrine_Core::VALIDATE_ALL);
	$nvsl->db_Manager->setAttribute(Doctrine_Core::ATTR_EXPORT,Doctrine_Core::EXPORT_ALL);
	$nvsl->db_Manager->setAttribute(Doctrine_Core::ATTR_MODEL_LOADING,Doctrine_Core::MODEL_LOADING_CONSERVATIVE);
	
	Doctrine_Core::dropDatabases();
	Doctrine_Core::createDatabases();
	Doctrine_Core::generateModelsFromYaml(NVSL_BASE.DS.'util/schema.yml', NVSL_BASE.DS.'modelos');
	Doctrine_Core::createTablesFromModels(NVSL_BASE.DS.'modelos');
	
?>